- 准备一台虚拟机作为cm-server
- 配置ssh免密码登录,在cm-server上执行脚本
1
2
3
4
5
6
7
8
9
10
11
12
13
14CLUSTER_NODES=localhost
#replace ',' with space
CLUSTER_NODES=${CLUSTER_NODES//,/ }
FILE=~/.ssh/id_rsa.pub
if [ ! -f "${FILE}" ]; then
ssh-keygen -t rsa -P ''
fi
for i in $CLUSTER_NODES
do
scp ~/.ssh/id_rsa.pub root@${i}:/tmp
ssh root@${i} "cat /tmp/id_rsa.pub >> /root/.ssh/authorized_keys"
done
安装jdk
- 创建链接,mkdir /usr/java;ln -s ${JAVA_HOME} /usr/java/default
安装perl
- 下载perl-5.16.2.tar.gz到cm-server上
- 解压
- cd perl-5.16.2
- ./Configure -des -Dprefix=/usr/local/perl -Dusethreads -Uversiononly
- make
- make install
安装cloudera manager
- 下载cloudera-manager-centos7-cm5.8.0_x86_64.tar.gz到cm-server上
- 解压到/opt目录下,tar -zxvf cloudera-manager-centos7-cm5.8.0_x86_64.tar.gz –C /opt
- 修改/opt/cm-5.8.0/etc/cloudera-scm-agent/config.ini的server_host为cm-server的ip地址
创建cm用户
- useradd –system –home=/opt/cm-5.8.0/run/cloudera-scm-server –no-create-home –shell=/bin/false –comment “Cloudera SCM User” cloudera-scm
修改/etc/hosts,配置所有cm节点的IP和hostname,包括cm-server和cm-agent
其他系统配置
关闭防火墙
service iptables stop (临时关闭)
chkconfig iptables off (重启后永久生效)
关闭SELinux
setenforce 0 (临时生效)
修改 /etc/selinux/config下的 SELINUX=disabled (重启后永久生效)
修改/etc/sysctl.conf,在最后一行加上:vm.swappiness=0
- 修改/etc/rc.local,在最后一行加上:echo never > /sys/kernel/mm/transparent_hugepage/defrag
- 重启cm-server
克隆虚拟机cm-server,到所有cm agent节点
在cm-server上安装mysql
创建并配置数据库
- create database <data_name> DEFAULT CHARSET utf8 COLLATE utf8_general_ci;
- 需要创建的数据库有:cm,hive,sentry,oozie,hue
root授权访问以上所有的数据库:
grant all on *.* to root@’%’;
grant all privileges on *.* to root@’%’ identified by ‘admin’;
拷贝JDBC驱动mysql-connector-java-5.1.39-bin.jar到cdh: /opt/cm-5.8.0/share/cmf/lib
- 初始化cm数据库:
- sh /opt/cm-5.8.0/share/cmf/schema/scm_prepare_database.sh mysql cm
- sh /opt/cm-5.8.0/share/cmf/schema/scm_prepare_database.sh mysql cm
- 准备parcels,用于安装CDH,下载parcels到cm-server: /opt/cloudera/parcel-repo,注意把.sha1文件的后缀改为.sha,且最好用sha1sum命令确认文件没有在下载中损坏
- 拷贝JDBC驱动mysql-connector-java-5.1.39-bin.jar到/opt/cloudera/parcels/CDH/lib/hive/lib和/var/lib/oozie
- 启动cm-server,sh /opt/cm-5.8.0/etc/init.d/cloudera-scm-server start
- 启动每个cm-agent,sh /opt/cm-5.8.0/etc/init.d/cloudera-scm-agent start